#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

void print(int a)
{
    std::cout<<a<<" ";
}
int main()
{

    //非变动算法
    vector<int> v = {3,2,4,3,5};
    //for_each(v.begin(),v.end(),[](int a){cout<<a<<" ";});
    //cout<<endl;
    // cout<<count(v.begin(),v.end(),2)<<endl;//输出4
    //cout<<count_if(v.begin(),v.end(),[](int a){return a >= 3;})<<endl;//输出5
    // auto ite = min_element(v.begin(),v.end());//输出1
    // auto ite = max_element(v.begin(),v.end());//输出5
    // auto ite = find(v.begin(),v.end(),2);
    // while(ite != v.end())
    // {
    //     v.erase(ite);
    //     ite = find(v.begin(),v.end(),2);
    // };
    // //cout<<*ite<<endl;
    // for_each(v.begin(),v.end(),print);
    // auto ite = find_if(v.begin(),v.end(),[](int a){return a >= 3;});
    // cout<<*ite<<endl;   //输出4
    // auto ite = search_n(v.begin(),v.end(),3,3);
    // cout<<*ite<<endl;//查找连续count个value,返回第一个元素的迭代器  //3
    std::vector<int> v2 = {4,3};
    auto ite = search(v.begin(),v.end(),v2.begin(),v2.end());
    std::cout<<*(ite - 2)<<std::endl;
    return 0;
}